package com.hk.service.sys.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import com.hk.commons.HqlFilter;
import com.hk.commons.LongId;
import com.hk.commons.entity.sys.SysModuleResource;
import com.hk.dao.base.impl.BaseServiceImpl;
import com.hk.service.sys.ISysModuleResource;




@Service
public class SysModuleResourceImpl extends BaseServiceImpl<SysModuleResource> implements ISysModuleResource {

	@Override
	public List<SysModuleResource> getByModuleId(Long moduleId) {
		HqlFilter hqlFilter =new HqlFilter();
		hqlFilter.addEQFilter("t.moduleId", moduleId);		
		return findByFilter(hqlFilter);
	}

	@Override
	public SysModuleResource get(Long id) {
		return getById(id);
	}

	@Override
	public SysModuleResource delete(Long id) {
		SysModuleResource model=new SysModuleResource();
		model.setId(id);
		delete(model);
		return model;
	}

	@Override
	public Long add(SysModuleResource model) {
		// TODO Auto-generated method stub
		
		Long id = LongId.get();
		model.setId(id);
		 save(model);
		return id;
	}

}
